package com.lfy.springcloud.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
public class CommonResult<T> implements Serializable {

    private Integer code;
    private String message;
    private T data;
    public CommonResult(Integer code, String message){
        this(code,message,null);
    }

    public CommonResult(T data){
        this(1,"操作成功",data);
        this.data = data;
    }

    public CommonResult(Integer code,String message,T data){
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public CommonResult(String message,T data){
        this.message = message;
        this.data = data;
        this.code = 1;
    }
}
